package day04

object MyPredef {
  //隐式转换方法
  implicit def fileToRichFile(file:String) = new RichFile(file);

  //隐式转换函数
  implicit val selectGirl = (g:OrderedGirl) => new Ordered[OrderedGirl]{
    override def compare(that: OrderedGirl): Int = {
      if (g.faceValue == that.faceValue){
        that.age  - g.age
      }else{
        g.faceValue - that.faceValue
      }
    }
  }

  //隐式对象
  implicit object OrderingGril extends Ordering[OrderedGirl]{
    override def compare(x: OrderedGirl, y: OrderedGirl): Int = {
      if(x.faceValue == y.faceValue){
        y.age - x.age
      }else{
        x.faceValue - y.faceValue
      }
    }
  }
}
